package com.xuhuan.demo.pattern.builder;

/**
 * @author huan.xu
 * @date 2021/10/5 22:11
 * @description 指挥者
 */
public class HouseDirector {

    private HouseBuilder houseBuilder;

    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    /**
     * 建房子的步骤交给指挥者决定
     *
     * @return
     */
    public House constructHouse() {
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.buildRoofed();
        return houseBuilder.buildHouse();
    }
}
